package com.myRule;

import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Random;

/**
 * @author young
 * @date 2022/12/23 19:41
 * @description: 自定义Ribbon负载均衡规则，父包不能在启动类所在包或子包下！
 */
@Configuration
public class MySelfRule {
    @Bean
    public IRule myRule(){
        //随机负载均衡模式
        return new RandomRule(); 
    }
}
